//
// Created by webturing on 2024/5/4.
//
#include<bits/stdc++.h>

using namespace std;

bool pin(long long int n) {
    long long int s = pow(n, 0.5);
    return s * s == n;
}

int yue(long long int n) {
    int jie = 2;
    for (long long int i = 2; i * i <= n; i++) {
        if ( n % i == 0 ) {
            jie += 2;
            if ( i * i == n ) jie--;
        }
    }
    return jie;
}


int main() {
    long long n;
    cin >> n;
    long long ji = 1;
    for (int i = 0; i < n; i++) {
        long long t;
        cin >> t;
        ji *= t;
    }
    for (long long int i = 2; i * i <= ji; i++) {
        if ( ji % i == 0 && (pin(i) || pin(ji / i))) {
            int ii = yue(i);
            int d = yue(ji / i);
            if ( abs(ii - d) == 1 ) {
                cout << ji / i << " " << d << endl;
                cout << i << " " << ii << endl;
                return 0;
            }
        }
    }
}